#ifndef _DEV_SDCARD_H_
#define _DEV_SDCARD_H_

#include "data_type.h"

#define DEV_SD_WAIT_TIME           ((uint32_t) 10000)

enum
{
    DEV_SD_TRANSFER_OK,  /* No data transfer is acting */
    DEV_SD_TRANSFER_BUSY,    /* Data transfer is acting */
};

enum
{
    DEV_SD_WAIT_READY = 0,
    DEV_SD_WAIT_TIMEOUT,
};

enum
{
    DEV_SD_OP_NO = 0,
    DEV_SD_OP_OK,
};

RET_STATUS dev_sdcard_init(void);
void dev_sdcard_show_info(void);
uint8_t dev_sdcard_get_status(void);

RET_STATUS dev_sdcard_write_blocks(uint32_t *pdata, uint32_t write_addr, uint32_t blocks_nbr, uint32_t timeout);
RET_STATUS dev_sdcard_read_blocks(uint32_t *pdata, uint32_t read_addr, uint32_t blocks_nbr, uint32_t timeout);
RET_STATUS dev_sdcard_write_blocks_dma(uint32_t *pdata, uint32_t write_addr, uint32_t blocks_nbr);
RET_STATUS dev_sdcard_read_blocks_dma(uint32_t *pdata, uint32_t read_addr, uint32_t blocks_nbr);
RET_STATUS dev_sdcard_write_disk_dma(const uint8_t *pbuf, uint32_t sector, uint32_t count);
RET_STATUS dev_sdcard_read_disk_dma(uint8_t *pbuf, uint32_t sector, uint32_t count);

#endif
